<template>
	<uni-list>
	
		<uni-list-chat v-for="item in list" :title="item.name" :avatarCircle="true" :avatar="'/static/head_icon.png'"
			:clickable="true" :showArrow="true" :showBadge="true" :badgeText="item.id" badgePositon="right"
			:note="item.department" :to='"../classmatedetail/classmatedetail?id="+item.id'></uni-list-chat>
	</uni-list>
	</uni-list>
</template>

<script>
	export default {
				data() {
					return {
						"list": [{
							"id": 1,
							"name": "小宋",
							"sex": "男",
							"icon":"../../static/1.jpg",
							"description":"",
							"price":202265110612
								},
								{
								"id": 9,
								"name": "小王",
								"sex": "男",
								"icon":"../../static/2.jpg",
								"description": "",
								"price": 202265110685,
								},
							  ]
							}
				        },
				methods: {
					loadclassmate() {
						uni.request({
							url: 'http://localhost:8090/xinsheng/user/list',
							method: 'POST',
							data: {},
							success: res => {
								if (res.data.success === true) {
									uni.hideLoading()
									this.list = res.data.list
									uni.showToast({
										title: '成功',
										icon: 'none'
									});
								} else {
									this.list = []
									uni.showToast({
										title: '失败',
										icon: 'none'
									});
								}
							},
							fail: () => {
								uni.showToast({
									title: '失败',
									icon: 'none'
								});
							},
							complete: () => {
								uni.hideLoading()
							}
			   });
			 }
		  },
		  onLoad() {
		  		this.loadclassmate()
		  	}
		  }
</script>

<style>
	.container {
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
	}
</style>